package com.example.nophase.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.nophase.R;
import com.example.nophase.entity.ApplyForListDTO;

import java.util.List;

public class ApplyForListAdapter extends BaseAdapter {

    List<ApplyForListDTO> resultList;
    Context context;

    public ApplyForListAdapter(List<ApplyForListDTO> resultList, Context context) {
        this.context = context;
        this.resultList = resultList;

    }

    public List<ApplyForListDTO> getResultList() {
        return resultList;
    }

    public void setResultList(List<ApplyForListDTO> resultList) {
        this.resultList = resultList;
    }

    @Override
    public int getCount() {
        return resultList.size();
    }

    @Override
    public Object getItem(int position) {
        return resultList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.project_list_item, null);
        TextView appMoney_tv = view.findViewById(R.id.applyfor_lv_money);
        TextView appDate_tv = view.findViewById(R.id.applyfor_lv_item_date);
        TextView appNum_tv = view.findViewById(R.id.applyfor_lv_item_num);
        TextView adult_money = view.findViewById(R.id.applyfor_lv_adultmoney);
        TextView adult_status = view.findViewById(R.id.adult_status);
        ApplyForListDTO item = resultList.get(position);
        adult_money.setText(item.getAuditMoney() + "根");
        appMoney_tv.setText(item.getAppMoney() + "根");
        appDate_tv.setText(String.valueOf(item.getAppDate()));
        appNum_tv.setText(item.getNo());
        if (item.getStatus().equals("已完成")) {
//            adult_status.setText(item.getCurrentUsername());
        } else {
//            adult_status.setText(item.getCurrentUsername());
        }

        return view;
    }

}
